﻿namespace SugarTank.Mobile.Translators
{
    using System.Collections.Generic;
    using System.Linq;
    using CommonTypes.Domain;
    using Contract;
    using ViewModels;

    public class ItemToItemViewModel : ITranslator<Item, ItemViewModel>
    {
        #region ITranslator<Item,ItemViewModel> Members

        /// <summary>
        /// Translates the specified input.
        /// </summary>
        /// <param name="input">The input.</param>
        /// <returns></returns>
        public ItemViewModel Translate(Item input)
        {
            return new ItemViewModel
                       {
                           LineOne = input.LineOne,
                           LineTwo = input.LineTwo,
                           LineThree = input.LineThree
                       };
        }

        /// <summary>
        /// Translates the specified input.
        /// </summary>
        /// <param name="input">The input.</param>
        /// <returns></returns>
        public IEnumerable<ItemViewModel> Translate(IEnumerable<Item> input)
        {
            return input.Select(Translate);
        }

        #endregion
    }
}